<?php
/**
 * Created by PhpStorm.
 * User: edmmss
 * Date: 2018/12/6
 * Time: 09:49
 */

namespace app\modules\proxy;


use yii\base\Exception;

class Record
{
    public $data;

    public function __construct(array $data = [])
    {
        $this->data = $data;
    }

    public function set(string $name, string $value)
    {
        $this->data[$name] = $value;
    }

    public function get(string $name): string
    {
        if (!isset($this->data[$name])) {
            throw new Exception('Invalid name given');
        }

        return $this->data[$name];
    }
}